package com.dragon.mmochat.message;

import com.dragon.mmochat.MmochatConstant;
import com.dragon.mmochat.model.gang.MmochatGang;
import com.dragon.mmochat.model.gang.MmochatGangRequester;
import com.skymobi.buffer.SkymobiBuffer;
import com.skymobi.message.SkymobiProtocolMessage;

public class Mmochat_15_10S extends SkymobiProtocolMessage {
	int hallState;
	MmochatGang gang;

	public Mmochat_15_10S() {
		setMsgCode(MmochatConstant.MSGCODE_MMOCHAT_S_15_10);
	}

	@Override
	protected void encodeBody(SkymobiBuffer out) {
		out.putUnsignedShort(hallState);
		out.put((byte) gang.getRequesters().size());
		for (MmochatGangRequester requester : gang.getRequesters().values()) {
			out.putInt(requester.getRoleId());
			out.putUnsignedShort(requester.getBmpId());
			out.putPrefixedString(requester.getName(), 1);
			out.putInt(requester.getLevel());
		}
	}

	public void setHallState(int hallState) {
		this.hallState = hallState;
	}

	public void setGang(MmochatGang gang) {
		this.gang = gang;
	}

}